<?php
	// Author: Andy Marti
	// Datum: 12.03.2014
	// ----------------------------------------------------
	// Beschreibung Klasse:
	//   Die Klasse enthält alle Eigenschaften und Methoden der Job.
	//   Sie wird in der Klasse User erzeugt.
	// ----------------------------------------------------
	// Änderungen:
	//
	// ----------------------------------------------------

	require_once 'base.php';
	require_once 'constants.php';

	
	/**
	* @author Andy Marti
	 *
	*/
	class Job extends Base {
		// ------------------------------------------------
		/**
		 * Die Eigenschaften der Klasse.
		 *
		 * @var UserID
		 * @var JobList
		 * 
		 */
		// Public Variables.
		public $UserID = -1;
		// Public Objects.
		public  $JobList = NIL;

		// ------------------------------------------------
		// Public methodes.
		public function getJobData($userid) {
			If ($this->checkInitial()) {
				if (empty($userid)) {
					$this->Messages->throwMessage($this->Messages->NumWrongUserId, '');
				}
				// Get job data from UserDB object.
				$this->UserDb->getJobs($this, $userid);
				$this->UserID = $userid;
			}
		}
			
		/**
		 * 
		 * @return string:
		 */
		public function getJobsAsString() {
			foreach ($this->JobList as $job) {
				$res[] = $job['JobType'];
			}
			return implode(', ', $res);
		}

		// ------------------------------------------------
		// Contructor, Destructor.
		/**
		 * Construtor. 
		 * 
		 */
		public function __construct(){
		}
		
		/**
		 * Destructor.
		 *
		 */
		public function __destruct(){
			// Destroy internal objects.
		}
	}
?>